#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from dragon.selector import Selector
from dragon.page import DraPage

class StockListSe:
    stockBlock = Selector('li.infinite-list-item', '股票块')
    stock=Selector('div.demo6-item-name>div','股票')
    stockCode=Selector('div.demo6-item-name>div>span','股票代码')
    changeCount=Selector('div.demo6-item-moneyNum>span','异动次数')
    changeTime=Selector('div.demo6-item-BkName>span','异动时间')
    realtimeIncrease=Selector('div.demo6-shishi>div','实时涨幅')
    changeIncrease=Selector('div.demo-yidong>div','异动涨幅')
    changeDetailButton=Selector('div.demo6-item-right>div.date-right','资金详情按钮')
    clickableChangeDetailButton = Selector(
        'div.demo6-item-right>div.date-right[style="color: rgb(65, 109, 249);"]', '可点击的资金详情按钮')
    # changeDetailItem = Selector('div.detil-item', '资金详情行')
    changeDetailTime=Selector('div.detil-item-time','资金详情时间')
    auction=Selector('div.jlk>div:nth-child(1)>div','集合竞价')
    circulation=Selector('div.jlk>div:nth-child(2)>div','流通值')
    openVolume=Selector('div.jlk>div:nth-child(3)>div','集合竞价')
    labelBar=Selector('div.labels','标签栏')
    label=Selector('div.labels>div','标签')
    notMatchAlert=Selector('div.emptySelect-title','空数据提示')
    notTradeTimeAlert=Selector('div.emptyTime-title','非交易时间提示')
    labelDescFloat=Selector('div.FlotItem','股票说明浮窗')
    includeTime=Selector('div.naru','纳入时间')
    
class StockList:
    def __init__(self, draPage: DraPage):
        self.draPage = draPage
        self.stockBlock = draPage.locator(StockListSe.stockBlock)
        self.stock = draPage.locator(StockListSe.stock)
        self.stockCode = draPage.locator(StockListSe.stockCode)
        self.changeCount = draPage.locator(StockListSe.changeCount)
        self.changeTime = draPage.locator(StockListSe.changeTime)
        self.realtimeIncrease = draPage.locator(StockListSe.realtimeIncrease)
        self.changeIncrease = draPage.locator(StockListSe.changeIncrease)
        self.changeDetailButton = draPage.locator(StockListSe.changeDetailButton)
        self.clickableChangeDetailButton = draPage.locator(StockListSe.clickableChangeDetailButton)
        # self.changeDetailItem = draPage.locator(StockListSe.changeDetailItem)
        self.changeDetailTime = draPage.locator(StockListSe.changeDetailTime)
        self.auction = draPage.locator(StockListSe.auction)
        self.circulation = draPage.locator(StockListSe.circulation)
        self.openVolume = draPage.locator(StockListSe.openVolume)
        self.labelBar = draPage.locator(StockListSe.labelBar)
        self.label = draPage.locator(StockListSe.label)
        self.notMatchAlert = draPage.locator(StockListSe.notMatchAlert)
        self.notTradeTimeAlert = draPage.locator(StockListSe.notTradeTimeAlert)
        self.labelDescFloat = draPage.locator(StockListSe.labelDescFloat)
        self.includeTime = draPage.locator(StockListSe.includeTime)